﻿//创建时间: 2010-12-10
//创建作者: 李 城
//功能说明: 评论设置
//最后修改: 2010-12-10

using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using TRPOP.Common;
using TRPOP.CMS.Web.UI;


using TRPOP.CMS.Business;
using TRPOP.CMS.Model;
using System.Collections;

namespace TRPOP.CMS.Web.Admin
{
    public partial class Recomment_setting : BaseAdmin
    {
        #region 当前页面权限验证
        protected override void SubPageInit()
        {
            base.m_strPagePermissionExtraKey = "Plugin_comment";
        }
        #endregion

        #region 页面变量
        protected string m_Title = "评论设置";
        protected string m_strRefer = "Recomment_list.aspx";
        protected string m_ConfigTypeKey = "Recomment";
        protected string m_ParamKey = "Recomment";
        #endregion

        #region 页面事件

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadBase();
            }
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {

            RecommentConfigInfo oRecommentConfigInfo = SYSConfig.RecommentConfigerInfo;

            oRecommentConfigInfo.EnableAudit = rbtRecommentEnableAudit.SelectedValue.ToBool();
            oRecommentConfigInfo.Length_UserNameMax = txtRecommentUsernameLengt.Text.Trim().ToInt();
            oRecommentConfigInfo.Length_ContentMin = txtRecommentContentMinLength.Text.Trim().ToInt();
            oRecommentConfigInfo.Length_ContentMax = txtRecommentContentMaxLength.Text.Trim().ToInt();
            oRecommentConfigInfo.EnableTextReplace = rbtRecommentEnableTextReplace.SelectedValue.Trim().ToBool();
            oRecommentConfigInfo.TextReplace = txtRecommentTextReplace.Text.Trim();
            oRecommentConfigInfo.TextReplaceList = txtRecommentTextReplaceList.Text.Trim();
            oRecommentConfigInfo.URL_GetCount = txtRecommentGetCountUrl.Text.Trim();
            oRecommentConfigInfo.URL_Submit = txtRecommentSubmitUrl.Text.Trim();
            oRecommentConfigInfo.URL_List = txtRecommentListUrl.Text.Trim();
            oRecommentConfigInfo.URL_CheckCode = txtRecommentCheckCodeUrl.Text.Trim();
            oRecommentConfigInfo.FormItem_Name = txtrecName.Text.Trim();
            oRecommentConfigInfo.FormItem_Detail = txtrecDetail.Text.Trim();
            oRecommentConfigInfo.FormItem_IndexID = txtindexid.Text.Trim();
            oRecommentConfigInfo.FormItem_ValidCode = txtrecvalidCode.Text.Trim();

            base.SaveLog(Plugin.LogKeys.OperObject.PluginOper, Plugin.LogKeys.OperResult.EditSubmit, m_ConfigTypeKey);

            SYSConfig.RecommentConfigerInfo = oRecommentConfigInfo;

            SubmitAlertAndThisNewLocation(true, m_strRefer);

        }

        #endregion

        #region 页面方法

        public void LoadBase()
        {

            RecommentConfigInfo oRecommentConfigInfo = SYSConfig.RecommentConfigerInfo;

            rbtRecommentEnable.SelectedValue = oRecommentConfigInfo.Enable.ToString().ToLower();
            rbtRecommentEnableAudit.SelectedValue = oRecommentConfigInfo.EnableAudit.ToString().ToLower();
            txtRecommentUsernameLengt.Text = oRecommentConfigInfo.Length_UserNameMax.ToString();
            txtRecommentContentMinLength.Text = oRecommentConfigInfo.Length_ContentMin.ToString();
            txtRecommentContentMaxLength.Text = oRecommentConfigInfo.Length_ContentMax.ToString();
            rbtRecommentEnableTextReplace.SelectedValue = oRecommentConfigInfo.EnableTextReplace.ToString().ToLower();
            txtRecommentTextReplace.Text = oRecommentConfigInfo.TextReplace;
            txtRecommentTextReplaceList.Text = oRecommentConfigInfo.TextReplaceList;
            txtRecommentGetCountUrl.Text = oRecommentConfigInfo.URL_GetCount;
            txtRecommentSubmitUrl.Text = oRecommentConfigInfo.URL_Submit;
            txtRecommentListUrl.Text = oRecommentConfigInfo.URL_List;
            txtRecommentCheckCodeUrl.Text = oRecommentConfigInfo.URL_CheckCode;
            txtrecName.Text = oRecommentConfigInfo.FormItem_Name;
            txtrecDetail.Text = oRecommentConfigInfo.FormItem_Detail;
            txtindexid.Text = oRecommentConfigInfo.FormItem_IndexID;
            txtrecvalidCode.Text = oRecommentConfigInfo.FormItem_ValidCode;
        }
        #endregion
    }
}
